Las Reliquias de Tolti Aph

An interactive fiction by Graham Nelson (2005) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Section E(f) - "Solid Rock" y los límites del laberinto

[ "Solid Rock" es una habitación que nunca se visita, pero que se usa para indicar las rutas bloqueadas: una salida que conduce a Roca Solida se considera bloqueada. Inicialmente, cuando ninguna de las habitaciones del laberinto han sido "jugadas", todas las salidas están bloqueadas de esta manera. Además Roca Sólida se usa como valor especial que significa que ninguna habitación está colocada en cierta posición de la cuadrículoa: así "the room at <1,4,12>" podría evaluarse a una habitación presente en el laberinto, o podría evaluarse a Solid Rock.]

Solid Rock is a room.

To make all labyrinth exits lead to Solid Rock:
    repeat with blank room running through labyrinth rooms
    begin;
        let Sh be the shape of the blank room;
        if U part of Sh is 1, change the up exit of blank room to Solid Rock;
        if D part of Sh is 1, change the down exit of blank room to Solid Rock;
        if N part of Sh is 1, change the north exit of blank room to Solid Rock;
        if E part of Sh is 1, change the east exit of blank room to Solid Rock;
        if S part of Sh is 1, change the south exit of blank room to Solid Rock;
        if W part of Sh is 1, change the west exit of blank room to Solid Rock;
    end repeat.

To decide which room is the room at (grid ref - a spatial coordinate):
    if grid ref is <0,0,0> then decide on Solid Rock;
    repeat with R running through rooms
    begin;
        if the grid position of R is grid ref then decide on R;
    end repeat;
    decide on Solid Rock.